package com.bkgy.jobs;

import com.bkgy.controller.outputRecord.service.IOutputRecordService;
import com.bkgy.controller.repOutput.service.IRepOutputService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 每日0点执行
 * 1.酸轧生产效率模型》产量最高记录更新
 * 2.检查产量是否打破记录
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class TcmCapacityJob {
    private final IRepOutputService repOutputService;
    private final IOutputRecordService breakRecordService;

    public void exec() {

        //任务1：酸轧生产效率模型》产量最高记录更新
        try {
            repOutputService.updateRecordPerDay();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }

        //任务2：检查上一天或上个月是否打破产量记录
        try {
            breakRecordService.buildRecordJob();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
}
